/**
 * 获取AppToken
 */
import Cookies from 'js-cookie'
import setting from '../setting'

const key = setting.appTokenKey
const role = setting.appRoleKey
const id = setting.appUIDKey

export function getToken() {
  return Cookies.get(key)
}

export function setToken(token) {
  return Cookies.set(key, token)
}

export function removeToken() {
  return Cookies.remove(key)
}

export function setUserRole(roleType) {
  return Cookies.set(role, roleType)
}

export function getUserRole() {
  return Cookies.get(role)
}

export function removeRole() {
  return Cookies.remove(role)
}

export function setUID(uid) {
  return Cookies.set(id, uid)
}

export function getUID() {
  return Cookies.get(id)
}

export function removeUID() {
  return Cookies.remove(id)
}

export function logOut() {
  removeToken()
  removeRole()
  removeUID()
}
